home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 1 of 3 / CHAPTE20 / EX5.C < prev    next >
C/C++ Source or Header  |  1995-03-19  |  2KB  |  47 lines

  1. #include <genstub.c>
  2.  
  3. // WndProc Window message procedure
  4. LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
  5. {
  6.    switch (uMsg)   // Process Windows messages. 
  7.    {
  8.       case WM_COMMAND:   // Process the menu items.
  9.             switch ( LOWORD( wParam ) )
  10.                 {
  11.                    case IDM_TEST:            // Write the tick count to the INI file 
  12.                        InvalidateRect( hWnd, NULL, TRUE );
  13.                        UpdateWindow( hWnd );
  14.                        break;
  15.                    case IDM_EXIT:
  16.                        DestroyWindow( hWnd );
  17.                        break;
  18.                 }
  19.             break;
  20.       case WM_PAINT: 
  21.          {
  22.             PAINTSTRUCT ps;
  23.             TCHAR szBuffer[128];
  24.             UINT uCurrency = GetProfileInt( "Intl",              // section name
  25.                                             "iCurrency",         // key name
  26.                                             0 );                 // default value
  27.             UINT uCurrencyDigits = GetProfileInt( "Intl"   ,     // section name
  28.                                                   "iCurrDigits", // key name
  29.                                                   0 );           // default value
  30.             BeginPaint( hWnd, &ps );
  31.             wsprintf( szBuffer, "Currency setting is %d. Number of currency digits is %d.",
  32.                       uCurrency, uCurrencyDigits);
  33.             TextOut( ps.hdc, 0, 0, szBuffer, lstrlen(szBuffer) );
  34.             EndPaint( hWnd, &ps );
  35.          }
  36.       break;
  37.       case WM_DESTROY:
  38.          PostQuitMessage( 0 );
  39.       break;
  40.       default:
  41.             return DefWindowProc( hWnd, uMsg, wParam, lParam );
  42.    }
  43.    return( 0L );
  44. }
  45.  
  46. #include <about.c>
  47.